package concurrent.reentrantlock;


/**
 * 模拟死锁，因为使用的锁是可重入的所以不会死锁
 */
public class Count {
    MyReentrantLock lock = new MyReentrantLock();
    public void print() throws InterruptedException {
        lock.lock();
        doAdd();
        lock.unlock();
    }
    public void doAdd() throws InterruptedException {
        lock.lock();
        System.out.println("not block");
        lock.unlock();
    }

    public static void main(String[] args) {
        Count count = new Count();
        try {
            count.print();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}


